//
//  TestInfoViewModel.m
//  HonlivApp
//
//  Created by admin on 2017/6/27.
//  Copyright © 2017年 honliv. All rights reserved.
//

#import "TestInfoViewModel.h"
#import "TestInfoModel.h"

static NSString *const testInfo_url = @"api/Account/GetOuptLab";

@implementation TestInfoViewModel

-(void)getTestInfoWithPage:(NSString *)page success:(void (^)())completion{
    NSString *url = [NSString stringWithFormat:@"%@%@",HOSPITAL_URL,testInfo_url];
    NSDictionary *dic = @{@"patient_id":[User currentUser].patientId,@"flag":page};
    [NetWorker getCommonDatasWithURLStr:url body:dic success:^(id result) {
        NSArray *resultArr = [JsonHelper arrayWithJsonString:result[@"Entity"]];
        NSMutableArray *modelArr = [NSMutableArray array];
        for (NSString *jsonStr in resultArr) {
            TestInfoModel *model = [TestInfoModel yy_modelWithJSON:jsonStr];
            [modelArr addObject:model];
        }
        _datasArray = [NSArray arrayWithArray:modelArr];
        completion();
    } failure:^(id result) {
        _datasArray = [NSArray array];
        completion();
    }];

}

@end
